#! /usr/bin/env bash

readonly PROGNAME="yamllint"

if command -v ${PROGNAME} >/dev/null; then
	exec ${PROGNAME} "$@"
fi

if command -v docker >/dev/null; then
	exec docker run --rm -ti \
		-v $(pwd):/workdir \
		giantswarm/yamllint "$@"
fi

cat <<EOF
Unable to run yamllint. Please check installation instructions:
	https://github.com/adrienverge/yamllint#installation
EOF

exit 69 # EX_UNAVAILABLE
